#pragma once

#include "StoredAnimationNode.h"
#include <map>
class Animation;
typedef map<tstring,AnimationNode*>::const_iterator AnimIT;

#include "boost/smart_ptr/shared_ptr.hpp"
using namespace boost;

typedef boost::shared_ptr<Animation>  AnimationPtr;

/**
* This class stores the animation tranformations for all the
* animated nodes in an object.
* @author Koen Samyn
*/
class Animation
{
public:
	/**
	* Creates a new Animation object.
	* @param name the name for the animation.
	* @param start the start frame for the animation.
	* @param stop the stop frame for the animation.
	* @param scale the scale for the animation (smaller values = faster animation)
	*/
	Animation(tstring name,unsigned int start, unsigned int stop, float scale=1.0f);
	/**
	* Destroys the animation object.
	*/
	virtual ~Animation(void);
	/**
	* Returns the name for the animation.
	* @return the name of the animation
	*/
	tstring GetName(){
		return m_Name;
	}
	/**
	* Returns the start frame for the animation.
	* @return the start frame for the animation.
	*/
	unsigned int GetStartFrame(){
		return m_Start;
	}
	/**
	* Returns the stop frame for the animation.
	* @return the stop frame for the animation.
	*/
	unsigned int GetStopFrame(){
		return m_Stop;
	}
	/**
	* Return the time scale for the animation.
	* @return the time scale.
	*/
	float GetTimeScale(){
		return m_Scale;
	}
	/**
	* Adds an animation node to this animation object.
	* @param node the node to add.
	*/
	void AddAnimationNode(AnimationNode* node);
	/**
	* Tries to find an animation node with the given name in this Animation.
	* @param name the name of the animation node (corresponds to the bone name).
	* @return the animation node.
	*/
	AnimationNode* GetAnimationNode(wstring& name);
	

	/**
	* Returns the beginning of the animationnode map.
	* @return the beginnig of the animation node map.
	*/
	AnimIT AnimationBegin(){
		return m_Animations.begin();
	}
	/**
	* Returns the end of the animation  node map.
	* @return the end of the animation node map.
	*/
	AnimIT AnimationEnd(){
		return m_Animations.end();
	}

	/**
	* Gets the interval where the animation plays.
	* @return the interval of the animation.
	*/
	unsigned int GetInterval()
	{
		return m_Stop-m_Start;
	}
private:
	/**
	* The name for the animation
	*/
	tstring m_Name;
	/**
	* The start frame for the animation.
	*/
	unsigned int m_Start;
	/**
	* The stop frame for the animation
	*/
	unsigned int m_Stop;
	/**
	* The scale for the animation.
	*/
	float m_Scale;
	/**
	* The map with all the animation nodes.
	*/
	map<tstring,AnimationNode*> m_Animations;
	// -------------------------
	// Disabling default copy constructor and default assignment operator.
	// If you get a linker error from one of these functions, your class is internally trying to use them. This is
	// an error in your class, these declarations are deliberately made without implementation because they should never be used.
	// -------------------------
	Animation(const Animation& t);
	Animation& operator=(const Animation& t);

};
